import {createConnection} from 'net'
function connect(){
    var tcp = createConnection({host:'39.98.79.122',port:9001})
    tcp.on('connect',(data)=>   {
        console.log('链接成功')
    })
    tcp.on('data',(data)=>{
        console.log('客户端收到数据:'+data.toString())
    })
    tcp.on('close',()=>{
        console.log('客户端链接断开')    
        connect();
    })
    tcp.on('error',()=>{})
    // tcp.connect()
}
connect()